import 'package:flutter/material.dart';
// import '../Form.dart';

class CategoryPage extends StatefulWidget {
  CategoryPage({Key key}) : super(key: key);

  @override
  _CategoryPageState createState() => _CategoryPageState();
}

class _CategoryPageState extends State<CategoryPage> {
  @override
  Widget build(BuildContext context) {
    return DefaultTabController(
        length: 2,
        child: Scaffold(
            appBar: AppBar(
              title: Row(
                children: <Widget>[
                  Expanded(
                      child: TabBar(
                    isScrollable: true,
                    tabs: <Widget>[Tab(text: "热门"), Tab(text: "关注")],
                  ))
                ],
              ),
            ),
            body: TabBarView(
              children: <Widget>[
                ListView(
                  children: <Widget>[
                    ListTile(
                      title: Text("热门"),
                    ),
                    ListTile(
                      title: Text("热门"),
                    ),
                    ListTile(
                      title: Text("热门"),
                    ),
                    ListTile(
                      title: Text("热门"),
                    ),
                    ListTile(
                      title: Text("热门"),
                    )
                  ],
                ),
                ListView(
                  children: <Widget>[
                    Column(
                      crossAxisAlignment: CrossAxisAlignment.start,
                      mainAxisAlignment: MainAxisAlignment.center,
                      children: <Widget>[
                        RaisedButton(
                          child: Text("跳转表单页面并传值"),
                          onPressed: () {
                            // Navigator.of(context)
                            //     .push(MaterialPageRoute(builder: (context) => FormPage()));
                            Navigator.pushNamed(context, '/form');
                          },
                        )
                      ],
                    ),
                    ListTile(
                      title: Text("关注"),
                    ),
                    ListTile(
                      title: Text("关注"),
                    ),
                    ListTile(
                      title: Text("关注"),
                    ),
                    ListTile(
                      title: Text("关注"),
                    ),
                    ListTile(
                      title: Text("关注"),
                    )
                  ],
                )
              ],
            )));
  }
}
